<template>
  <div>
    <div class="checkEntAuth">
      <header class="mint-header is-fixed">
        <div class="mint-header-button is-left">
          <button class="mint-button mint-button--default mint-button--normal">
            <span class="mint-button-icon">
              <i class="mintui mintui-back" @click="$router.go(-1)"></i>
            </span>
          </button>
        </div>
        <h1 class="mint-header-title">企业实名信息</h1>
        <div class="mint-header-button is-right">
          <button class="mint-button mint-button--default mint-button--normal">
            <label class="mint-button-text"></label>
          </button>
        </div>
      </header>
      <div class="authStatus" v-if="vipUserAuth.authStatus == 1">
        企业实名认证已提交，等待审核中
      </div>
      <div class="authStatus" v-if="vipUserAuth.authStatus == 3">
        企业实名认证被拒绝，请重新提交
      </div>
      <div class="info">
        <label>会员名</label>
        <div class="text">{{userName}}</div>
        <label>企业名称</label>
        <div class="text">{{vipUserAuth.authEName}}</div>
        <label>营业执照注册号</label>
        <div class="text">{{vipUserAuth.authELicenseCode}}</div>
        <label>企业营业地址</label>
        <div class="text">{{vipUserAuth.authProvinceName}} {{vipUserAuth.authCityName}} {{vipUserAuth.authAreaName}}</div>
        <div class="text">{{vipUserAuth.authEAddress}}</div>
        <label>营业执照图片</label>
        <div class="text">
          <div class="pic"><img :src="vipUserAuth.authLicenseImage" alt=""></div>
        </div>
      </div>
      <div style="width:100%;text-align: center;margin-top:50px;">
        <button class="submit" @click="submit" v-if="vipUserAuth.authStatus != 2">重新编辑</button>
      </div>
    </div>
  </div>
</template>
<script>
import {
  mapGetters
} from 'vuex'
import {
  getEntAuthInfo
} from '@/api/user'
import { Toast } from 'mint-ui'
export default {
  data() {
    return {
      userName: '',
      vipUserAuth: {}
    }
  },
  watch: {
  },
  components: {
  },
  computed: {
    ...mapGetters([
      'userInfo'
    ])
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      // 判断是否登录
      this.isLogin = this.userInfo ? 1 : 0
      if (!this.userInfo) return
      this.userName = this.userInfo.userName
      getEntAuthInfo({ 'userId': this.userInfo.id }).then(res => {
        this.vipUserAuth = res.data.vipUserAuth
        console.log(this.vipUserAuth)
      }).catch(err => {
        Toast(err.info)
      })
    },
    submit() {
      this.$router.replace({
        name: 'addEntAuth',
        query: {
          authStatus: this.vipUserAuth.authStatus
        }
      })
    }
  }
}

</script>
<style lang="scss">
@import '~assets/common/css/mixin.scss';

.checkEntAuth {
  min-height: 100vh;
  margin-top: 40px;
  padding-bottom: 100px;
  .mint-header {
    background-color: #FFF;
    color: #000;
    z-index: 2;
    font-size: 16px;
  }
  .authStatus {
    background: #f0f9fb;
    color: #d69e24;
    height: 49px;
    line-height: 49px;
    padding: 0 15px;
  }
  .info {
    label {
      color: #1C252A;
      font-size: 12px;
      padding: 15px 15px;
      display: block;
      background-color: #FCFCFC;
    }
    .text {
      color: #868686;
      font-size: 12px;
      padding: 15px 15px;
      background-color: #FFF;
      .pic {
        width: 20px;
        height: 20px;
        display: table-cell;
        text-align: center;
        background-color: #fff;
        img {
          height: 100px;
        }
      }
    }
  }
  .submit {
    width: 90%;
    height: 45px;
    line-height: 45px;
    text-align: center;
    background: #ff6600;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
  }
}
</style>
